import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/web/login',
    method: 'post',
    data: { userName: data.username, password: data.password }
  })
}

export function checkToken(data) {
  return request({
    url: '/web/checkToken',
    method: 'post',
    data: { userName: data.userName, para: data.token }
  })
}

export function savePassword(data) {
  return request({
    url: '/web/savePassword',
    method: 'post',
    data: { userName: data.username, password: data.password }
  })
}

export function getInfo(token) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 1, para: token }
    // params: {EventId:1, token }
  })
}

export function getRouterRoles() {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 3 }
  })
}

export function logout(token) {
  return request({
    url: '/web/Logout',
    method: 'post',
    data: { Para: token }
  })
}

export function getUsers(query) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 7, para: query }
  })
}

export function creatUser(user) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 8, para: user }
  })
}

export function updateUser(user) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 9, Para: user }
  })
}

export function updateStatus(user) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 10, para: user }
  })
}
// 删除用户
export function deleteUser(user) {
  return request({
    url: '/web/user',
    method: 'post',
    data: { eventId: 11, para: user }
  })
}
